package day4.homework;

import java.lang.reflect.Array;
//使用反射创建长度为5的String数组,为数组的前三个元素赋值："A", "B", "C"。
//打印数组的内容。(提示:Array.newInstance 来实例化数组)
public class TestString {
    public static void main(String[] args) {
      fun();
    }
    public static void fun(){
        Object o = Array.newInstance(String.class,5);
        Array.set(o,0,"A");
        Array.set(o,1,"B");
        Array.set(o,2,"C");
        for (int i = 0; i < Array.getLength(o); i++) {
            System.out.println(Array.get(o,i));
        }
    }
}
